//
//  ISCallSettingCollectionViewCell.m
//  iPhoneSafety
//
//  Created by dlon 2018/12/31.
//  Copyright © 2018年 com.li.ding. All rights reserved.
//

#import "ISCallSettingCollectionViewCell.h"
#import "NWLazyProperty.h"
#import <Masonry/Masonry.h>
#import "UIColor+NWHex.h"


@interface ISCallSettingCollectionViewCell()

@end

@implementation ISCallSettingCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.desLabel];
        [self.contentView addSubview:self.arrowView];
        
        [self.titleLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
        [self.desLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.left.equalTo(self.contentView).offset(17.f);
        }];
        
        [self.arrowView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(17.f, 17.f));
            make.right.equalTo(self.contentView).offset(-12.f);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.right.equalTo(self.arrowView.mas_left).offset(-7.f);
            make.left.equalTo(self.titleLabel.mas_right).offset(10.f);
        }];
        
    }
    return self;
}


#pragma mark - set & get

NWLazyPropertyWithInit(UILabel, titleLabel, {
    _titleLabel.font = [UIFont systemFontOfSize:17.f];
    _titleLabel.textColor = [UIColor nw_colorWithHex:0x222222];
})

NWLazyPropertyWithInit(UILabel, desLabel, {
    _desLabel.font = [UIFont systemFontOfSize:14.f];
    _desLabel.textColor = [UIColor nw_colorWithHex:0xA6ADB7];
    _desLabel.textAlignment = NSTextAlignmentRight;
})

NWLazyPropertyWithInit(UIImageView, arrowView, {
    _arrowView.image = [UIImage imageNamed:@"btn_rightarrow_n"];
})
@end
